 function getFactTablesNames() {                     
    jsonVar = new Object();
           
    $.ajaxSetup({async: false});

    //new array of factTables names
    var factTables = new Array();

    //get all fact tables from Database
    $.post("http://nalijepi.me/BI/itSmallBI/index.php/gettables/getfacttables", 

	    JSON.stringify(jsonVar),

	    function(data){

		    data = JSON.parse(data);
		    
		    setFactTables(data.facttables);
		    

	    }

    );

    //function sets all fact tables into array
    function setFactTables(data) {

	    for(i = 0; i < data.length; i++) {      
		    factTables[i] = data[i];        
	    }

    }

    return factTables;
}
				
function getDimensionTablesNames (factTableName) {

	jsonVar = new Object();
	
	$.ajaxSetup({async:false});
	
	var dimensionTables = new Array();
	
	//get all dimension tables associated with specific fact table (factTableName)
	$.post("http://nalijepi.me/BI/itSmallBI/index.php/gettables/gettableinfo/" + factTableName, 
		
		JSON.stringify(jsonVar),
		
		function (data){
		
			data = JSON.parse(data);
			setDimensionTables(data.dimensions);
			
		
		}
		
	);
	
	//function sets all dimension tables into array
	function setDimensionTables(data) {
		
		
		for(var i = 0; i < data.length; i++) {
			
			dimensionTables[i] = data[i];
					
			}
		
				
	}
	
	return dimensionTables;
							
}
				